import { instance as request } from "@/utils/request"

// const Get = (url: string, params?: any) => {
//   return request<any, RETURNDATA>({
//     method: "GET",
//     url,
//     params: params,
//   })
// }
// const Post = (url: string, data?: any) => {
//   return request<any, RETURNDATA>({
//     method: "POST",
//     url,
//     data: data,
//   })
// }
// const Put = (url: string, params?: any, data?: any) => {
//   return request<any, RETURNDATA>({
//     method: "PUT",
//     url,
//     data: data,
//     params: params,
//   })
// }
// const Delete = (url: string, params?: any) => {
//   return request<any, RETURNDATA>({
//     method: "DELETE",
//     url,
//     params: params,
//   })
// }
type RETURNDATA = {
  code: number
  msg: string
  data?: any
}

const getCode = (url: string, params?: any) => {
  return request<any, RETURNDATA>({
    method: "GET",
    url,
    params: params,
  })
}
const postLogin = (url: string, data?: any) => {
  return request<any, RETURNDATA>({
    method: "POST",
    url,
    data: data,
  })
}
const postRegister = (url: string, data?: any) => {
  return request<any, RETURNDATA>({
    method: "POST",
    url,
    data: data,
  })
}
const Gettest = (url: string, params?: any) => {
  return request<any, RETURNDATA>({
    method: "GET",
    url,
    params: params,
  })
}
const isOutData = (url: string, params?: any) => {
  return request<any, RETURNDATA>({
    method: "GET",
    url,
    params: params,
  })
}
export { postRegister, getCode, postLogin, Gettest, isOutData }
